﻿<Window x:Class="ImageConvert.MainWindow"
        x:Name="MainWin"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:common="clr-namespace:ImageUtils.Common;assembly=ImageUtils.Common"
        Title="Image Converter" Height="620" Width="500" Background="#FF595959" ResizeMode="NoResize"
        DataContext="{Binding RelativeSource={RelativeSource Self}}" Loaded="MainWin_Loaded" Closing="MainWin_Closing">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition/>
            <RowDefinition Height="25"/>
        </Grid.RowDefinitions>

        <Menu>
            <MenuItem Header="File">
                <MenuItem x:Name="FileExit" Header="Exit" Click="FileExit_Click"/>
            </MenuItem>
            <MenuItem Header="Input files" Height="23" Margin="0,1,0,0" VerticalAlignment="Top">
                <MenuItem x:Name="InputAdd" Header="Add" Click="InputAdd_Click"/>
                <MenuItem x:Name="InputAddDir" Header="Add Directory..." Click="InputAddDir_Click"/>
                <MenuItem x:Name="InputAddDirr" Header="Add Directory &amp; Subdirs" Click="InputAddDirr_Click"/>
                <MenuItem x:Name="InputClear" Header="Clear Files" Click="InputClear_Click"/>
                <MenuItem x:Name="InputRemove" Header="Remove Selected" Click="InputRemove_Click"/>
            </MenuItem>
        </Menu>
        <StackPanel  Grid.Row="1">
            <Expander Header="Input files" MaxHeight="250" IsExpanded="True">
                <ListBox x:Name="LbInFiles" Height="240" ItemsSource="{Binding Path=Files}"/>
            </Expander>

            <Expander Header="Output directory" IsExpanded="True">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="100"/>
                    </Grid.ColumnDefinitions>
                    <TextBox x:Name="TbOutDir" Grid.Column="0"/>
                    <Button x:Name="BtnBrowse" Grid.Column="1" Content="Browse ..." Click="BtnBrowse_Click"/>
                </Grid>
            </Expander>

            <Expander Header="Resize" IsExpanded="True">
                <StackPanel>
                    <RadioButton x:Name="RbResNochange" Content="No Change"/>
                    <RadioButton x:Name="RbResPercent" Content="Percent"/>
                    <common:EditableSlider x:Name="SlideResPercent" Minimum="0" Maximum="1" Value="1" Margin="10,0,0,0" IsEnabled="{Binding IsChecked, ElementName=RbResPercent}"/>
                    <RadioButton x:Name="RbResFitbox" Content="Fit box"/>
                    <StackPanel Orientation="Horizontal">
                        <common:EditableSlider x:Name="SlideResWidth" Width="150" Minimum="1" Maximum="10000" Value="1024" Margin="10,0,0,0" IsEnabled="{Binding IsChecked, ElementName=RbResFitbox}"/>
                        <TextBlock Text="x" Margin="10,0"/>
                        <common:EditableSlider x:Name="SlideResHeight" Width="150" Minimum="1" Maximum="10000" Value="768" IsEnabled="{Binding IsChecked, ElementName=RbResFitbox}" OverridesDefaultStyle="True" DataContext="{Binding}" />
                    </StackPanel>
                </StackPanel>
            </Expander>

            <Expander Header="Output format" IsExpanded="True">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <RadioButton x:Name="RbFormJpg" Content="JPG" Margin="0,0,10,0"/>
                    <RadioButton x:Name="RbFormPng" Content="PNG" Margin="0,0,10,0"/>
                        <RadioButton x:Name="RbFormBmp" Content="BMP" Margin="0,0,10,0"/>
                        <RadioButton x:Name="RbFormTiff" Content="TIFF" Margin="0,0,10,0"/>
                    </StackPanel>
                    <TextBlock Text="Quality:"/>
                    <common:EditableSlider x:Name="SlideFormatQuality" Minimum="0" Maximum="100" Value="100" Margin="10,0,0,0"/>
                    <TextBlock Text="Pixel format:"/>
                    <StackPanel Orientation="Horizontal">
                        <RadioButton x:Name="RbColorNo" Content="No Change" Margin="0,0,10,0"/>
                        <RadioButton x:Name="RbColor8bit" Content="8-bit indexed" Margin="0,0,10,0"/>
                        <RadioButton x:Name="RbColor24bit" Content="24 bit" Margin="0,0,10,0"/>
                        <RadioButton x:Name="RbColor32bit" Content="32 bit"/>
                    </StackPanel>
                </StackPanel>
            </Expander>
        </StackPanel>

        <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button x:Name="BtnConvert" Content="Convert" Width="100" Margin="0,0,10,0" Click="BtnConvert_Click" />
            <Button x:Name="BtnExit" Content="Exit" Width="100" HorizontalAlignment="Right" Margin="0,0,10,0" Click="FileExit_Click"/>
        </StackPanel>
    </Grid>
</Window>
